﻿namespace KC.Service.Core.Constants
{
    public sealed class CacheKeyConstants
    {
        private const string ComPrx = "com-";
        private const string CfwinPrx = "CFWin-";

        public const string MappingCacheKey = ComPrx + "offeringMappingCacheKey";

        public const string PermissionCacheKey = ComPrx + "PermissonCacheKey";

        public const string InvestmentOfferingCategoryCacheKey = ComPrx + "InvestmentOfferingCategoryCacheKey";
        public const string FinancingOfferingCategoryCacheKey = ComPrx + "FinancingOfferingCategoryCacheKey";
        public const string MallOfferingCategoryCacheKey = ComPrx + "MallOfferingCategoryCacheKey";

        public const string InvestmentItemCacheKey = ComPrx + "InvestmentItemCacheKey";
        public const string StoreItemCacheKey = ComPrx + "StoreItemCacheKey";
        public const string FinancingItemCacheKey = ComPrx + "FinancingItemCacheKey";
        public const string PlatformFinancialInstitutions = ComPrx + "PlatformFinancialInstitutions";
        public const string SellerFinancialInstitutions = ComPrx + "SellerFinancialInstitutions-";
        public const string LogisticsCompanies = CfwinPrx + "LogisticsCompanies";

        public const string TenantInfo = Prefix.TenantName + "-TenantInfo-";

        public const string DSFSXCompanys = ComPrx + "-DSFSXCompanys";
        public const string AllTenantCacheKey = ComPrx + "AllTenantCacheKey";

        public const string ShopDomains = ComPrx + "ShopDomains";

        public const string CMBChinaBankBillInfo = CfwinPrx + "CMBChinaBankBillInfo";

        public const string PlatOffCate = CfwinPrx + "PlatOffCate";
        public const string AllFinancialInstitutions = ComPrx + "AllFinancialInstitutions";
        public const string TopFiveHomeContent = ComPrx + "TopFiveHomeContent-";
        public const string DbaFiveHomeContent = ComPrx + "DbaFiveHomeContent";

        public class Prefix
        {
            public const string AuthUserId = ComPrx + "auth-";

            public const string AuthMemberId = ComPrx + "authMember-";

            public const string AuthOpenId = ComPrx + "weixin-";

            public const string CurrentUserId = ComPrx + "currentUserId-";

            public const string SessionId = CfwinPrx + "SSOToken-";
            public const string TenantSessionId = ComPrx + "SSOToken-";

            public const string AccessToken = CfwinPrx + "OAuth-AccessToken-";

            public const string TenantAuthTokenEndpoint = ComPrx + "OAuth-TokenEndpoint-";
            public const string TenantAccessToken = ComPrx + "OAuth-AccessToken-";
            public const string TenantRefreashToken = ComPrx + "OAuth-RefreashToken-";

            public const string DefaultSSOToken = CfwinPrx + "defaultssotoken-cfwinapp-";
            public const string DefaultTenantSSOToken = ComPrx + "defaulttenantssotoken-cfwinapp-";

            public const string CurrentUserMenuId = ComPrx + "currentUserMenuId-";

            public const string OfferingCatogoryId = ComPrx + "offeringCatogoryId-";

            public const string MessageTemplateId = ComPrx + "MessageTemplateId-";

            public const string TenantName = ComPrx + "tenant-";

            public const string ConfigName = ComPrx + "config-";

            public const string CurrentOperationApplicationId = ComPrx + "CurrentOperationApplicationId-";
            public const string Forgot = ComPrx + "Forgot-";

            public const string CreateElectronic = CfwinPrx + "CreateElectronic-";

            public const string Notice = ComPrx + "Notice-";
            public const string Marketing = ComPrx + "Marketing-";
            public const string VoiceCaptcha = ComPrx + "VoiceCaptcha-";
            public const string ForgotPassword = ComPrx + "ForgotPassword-";

            public const string LogisticsPlatforms = CfwinPrx + "LogisticsPlatformKey";
            public const string LogisticsPlatformAttr = CfwinPrx + "LogisticsPlatformAttrKey-";

            public const string WeixinAccessToken = ComPrx + "Wx-AccessToken-appid[{0}]--{1}";
            public const string WeixinJsTicket = ComPrx + "Wx-JsTicket-appid[{0}]-{1}";
            public const string WeixinOAuthToken = ComPrx + "Wx-OAuthToken-appid[{0}]-{1}-code-{2}";
        }

        public class FiltrationAttributes
        {
            public const string FinancingFiltrationAttributes = ComPrx + "FinancingFiltrationAttributes";

            public const string SupplyingFiltrationAttributes = ComPrx + "SupplyingFiltrationAttributes";

            public const string InvestmentFiltrationAttributes = ComPrx + "InvestmentFiltrationAttributes";

            public const string MallFiltrationAttributes = ComPrx + "MallFiltrationAttributes";

            public const string MallOfferingCategory = ComPrx + "MallOfferingCategory";

            public const string LoanFiltrationAttributes = ComPrx + "LoanFiltrationAttributes";

            public const string LoanAttributes = ComPrx + "LoanAttributes";

            public const string FinancingAttributes = ComPrx + "FinancingAttributes";

            public const string LoanCategory = ComPrx + "LoanCategory";

            public const string FinancingCategory = ComPrx + "FinancingCategory";

            public const string FinancingData = ComPrx + "FinancingData";

            public const string AdData = ComPrx + "AdData";
            public const string AdDetailData = ComPrx + "AdDetailData";
            public const string AdListData = ComPrx + "AdListData";

            public const string HomeplatShopinfoData = ComPrx + "HomeplatShopinfoData-";
            public const string ShopinfoDataOfTenantappid = ComPrx + "ShopinfoDataOfTenantappid-";

            public const string HomeOperUrlData = ComPrx + "HomeOperUrlData-";
        }

        public class CodeTypeCacheKey
        {
            public const string CityList = ComPrx + "CityList";
        }

        public class ShopConstants
        {
            public const string OfferingCates = ComPrx + "OfferingCates-";
        }

        public class CommonConstants
        {
            public const string CommercialAcceptanceBillConfig = Prefix.ConfigName + "CommercialAcceptanceBillConfig";
        }

        public class WeiXinCacheKey
        {
            public static string AccessTokenKey(string tenantName)
            {
                return ComPrx + "WeiXinAccessToken-" + tenantName.ToLower();
            }
            public static string JsTicketKey(string tenantName)
            {
                return ComPrx + "WeixinJsTicket-" + tenantName.ToLower();
            }
            public static string ConfigKey(string tenantName)
            {
                return ComPrx + "WeixinConfig-" + tenantName.ToLower();
            }
            public static string ShopInfoKey(string tenantName)
            {
                return ComPrx + "WeixinShopInfo-" + tenantName.ToLower();
            }
        }
    }

    public static class TimeOutConstants
    {
        /// <summary>
        /// Cookie：20分钟过期
        /// </summary>
        public const int CookieTimeOut = 20; //Cookie：20分钟过期
        /// <summary>
        /// Cache：12小时过期
        /// </summary>
        public const int CacheTimeOut = 12 * 60; //Cache：12小时过期
        /// <summary>
        /// Cache：5分钟过期
        /// </summary>
        public const int CacheShortTimeOut = 5; //Cache：5分钟过期
        /// <summary>
        /// AccessToken：60分钟过期
        /// </summary>
        public const int AccessTokenTimeOut = 60; //AccessToken：60分钟过期
        /// <summary>
        /// 短信验证码有效期：5分钟
        /// </summary>
        public const int PhoneCodeTimeout = 5;//短信验证码有效期
        /// <summary>
        /// 默认缓存有效期：30天
        /// </summary>
        public const int DefaultCacheTimeOut = 30 * 24 * 60; //Cache：30天
        /// <summary>
        /// 共用缓存有效期：15分钟
        /// </summary>
        public const int SharedCacheTimeOut = 15; //Cache：15分钟

        /// <summary>
        /// 微信Toke过期时间：120分钟过期
        /// </summary>
        public const int WeixTokenTimeOut = 120;
    }
}
